//用*打印金字塔

var num = 10;
for(i = 1;i < num;i++){
    
    var nbsp = num - i;
    
    for(j = 0;j < nbsp;j++){
        document.write("&nbsp");
    }
    
    var strat = (i-1)*2+1;
    
    for(k = 0;k < strat;k++){
        document.write("*");
    }
    
    document.write("<br>");
}